package redis;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

public class redis_cluster {
    public static void main(String[] args) {
        //连接
        HostAndPort hostAndPort = new HostAndPort("192.168.0.170",6379);
        JedisCluster jedisCluster = new JedisCluster(hostAndPort);
        //操作
        jedisCluster.set("k1","v1");
        String k1 = jedisCluster.get("k1");
        System.out.println(k1);
        //关闭连接
        jedisCluster.close();
    }
}
